package com.solomon.travel.common.front.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.solomon.travel.common.base.controller.BaseController;
import com.solomon.travel.common.model.ApiResponse;
import com.solomon.travel.common.model.Page;
import com.solomon.travel.common.po.Car;
import com.solomon.travel.common.service.CarService;
import com.solomon.travel.common.util.ConstantUtils;
import com.solomon.travel.common.util.PageUtils;

@RestController("frontCarController")
@RequestMapping("/front/car")
public class CarController extends BaseController{
	
	@Resource
	private CarService carService;
	
	@RequestMapping("/list")
	public ApiResponse list(Integer pageIndex,Integer pageSize,Car car) {
		int carCount = carService.countBySerch(car);
		Page page = PageUtils.createPage(pageSize, carCount, pageIndex);
		List<Car> cars = carService.listBySerch(car, page);
		return new ApiResponse(ConstantUtils.RESPONSE_CODE_OK, cars,page);
	}

}
